
import { gameConfigHandle } from 'js/config/gameConfig'
import AdventureModel from './adventureModel'
import { BagModel } from './bagModel'
import { BaseInfoModel } from './baseInfoModel'
import { ItemModel } from './itemModel'
import { ItemInfoModel } from './itemInfoModel'
import { FormationModel } from './formationModel'
import { TeamModel } from './teamModel'
import { TaskModel } from './taskModel'
import { DiaryModel } from './diaryModel'
import { ResourceModel } from './resourceModel'
import MarketModel from './marketModel'


export class PetsModel {
    altarList: ItemModel[]
    altarAddAmount: number
    constructor(opts: any = {}) {
        this.altarList = opts.altarList || []
        this.altarAddAmount = opts.altarAddAmount || 0
    }
}

export class RidesModel {
    altarList: ItemModel[]
    altarAddAmount: number
    constructor(opts: any = {}) {
        this.altarList = opts.altarList || []
        this.altarAddAmount = opts.altarAddAmount || 0
    }
}

export class DeepModel {
    times: number
    progress: number
    totalTimes: number
    nightTimes: number
    nightTodayProgress: number
    nightProgress: number
    constructor(opts: any = {}) {
        this.times = opts.times || 0
        this.progress = opts.progress || 0
        this.nightTodayProgress = opts.nightTodayProgress || 0
        this.nightProgress = opts.nightProgress || 0
        this.nightTimes = opts.nightTimes || 0
        this.totalTimes = opts.totalTimes || 0
    }
}

export class WorldBossModel {
    progress: number
    totalTimes: number
    expireTime: number
    times: number
    todayTimes: number
    constructor(opts: any = {}) {
        this.progress = opts.progress || 0
        this.totalTimes = opts.totalTimes || 0
        this.expireTime = opts.expireTime || 0
        this.times = opts.times || 0
        this.todayTimes = opts.todayTimes || 0
    }
}

export class TreasureInfoModel {
    treasureOn: ItemModel[]
    lvls: number[]
    treasurePower: number
    constructor(opts: any = {}) {
        this.lvls = opts.lvls || new Array(8).fill(1)
        this.treasureOn = opts.treasureOn || new Array(8)
        this.treasurePower = opts.treasureOn || 0
    }
}

export class ArenaInfoModel {
    score: number
    todayTimes: number
    totalTimes: number
    battleTimes: number
    constructor(opts: any = {}) {
        this.score = opts.score || 0
        this.totalTimes = opts.todayTimes || 0
        this.totalTimes = opts.totalTimes || 0
        this.battleTimes = 0
    }
}

export class TownInfoModel {
    booming: number
    saveScore: number
    lvl: number
    subBuildLvl: any
    buildStatus: any
    taskList: any[]
    decrScoreTimes: number
    searchTaskList: any[]
    searchTimes: number
    searchTaskTriggerTimes: number
    signInInfo: any
    makeInfo: any
    dayTownTaskTimes: number
    constructor(opts: any = {}) {
        this.booming = opts.booming || 0
        this.lvl = opts.lvl || 0
        this.subBuildLvl = opts.subBuildLvl || {}
        this.buildStatus = opts.buildStatus || {}
        this.saveScore = opts.saveScore || 100
        this.taskList = opts.taskList || []
        this.decrScoreTimes = opts.decrScoreTimes || null
        this.searchTaskList = opts.searchTaskList || []
        this.signInInfo = opts.signInInfo || { selfSignIn: false, serverSignIn: false }
        this.makeInfo = opts.makeInfo || {}
        this.dayTownTaskTimes = opts.dayTownTaskTimes || 0
        this.searchTaskTriggerTimes = opts.searchTaskTriggerTimes || 0
        this.searchTimes = opts.searchTimes || 0
    }
}

export class AlchemyInfoModel {
    lvls: any
    build: any
    accelerateTimes: number
    constructor(opts: any = {}) {
        this.lvls = opts.lvls || {}
        this.build = opts.build || {}
        this.accelerateTimes = opts.accelerateTimes || 0
    }
}

export class ConsumptiomInfo {
    dayInfo: any
    totalInfo: any
    constructor(opts: any = {}) {
        this.dayInfo = opts.dayInfo || {}
        this.totalInfo = opts.totalInfo || {}
    }
}

export class TitleInfo {
    infos: any
    constructor(opts: any = {}) {
        this.infos = opts.infos || {}
    }
}
export class HangUpInfo {
    hangup: boolean
    mapID: number
    constructor(opts: any = {}) {
        this.hangup = opts.hangup || false
        this.mapID = opts.mapID || null
    }
}
export class PlayerModel {
    ID: string
    totalPower: number
    playerName: string
    baseInfo: BaseInfoModel
    itemInfo: ItemInfoModel
    consumptiomInfo: ConsumptiomInfo
    adventureInfo: AdventureModel
    teamList: TeamModel
    barTeamList: any[]
    bag: BagModel
    equipmentBag: BagModel
    equipmentBag2: BagModel
    formation: FormationModel
    viewShow: any
    equipmentMaxPower: any
    equipmentMaxPowerData: any
    resource: ResourceModel
    task: TaskModel
    diary: DiaryModel
    market: MarketModel
    info: any
    treasureBag: BagModel
    isNewPlayer: boolean
    getResourceDate: number
    worldBossInfo: any
    wbInfo: WorldBossModel
    deepInfo: DeepModel
    treasureInfo: TreasureInfoModel
    arenaInfo: ArenaInfoModel
    alchemyInfo: AlchemyInfoModel
    gameSet: any
    floorStop: any
    townInfo: TownInfoModel
    titleInfo: TitleInfo
    constructor(opts: any = {}) {
        this.ID = opts.ID || ''
        this.playerName = opts.playerName || '无名勇者'
        this.baseInfo = new BaseInfoModel(opts.baseInfo)
        this.itemInfo = new ItemInfoModel(opts.itemInfo)
        this.adventureInfo = new AdventureModel(opts.adventureInfo)
        this.bag = new BagModel(opts.bag)
        this.equipmentBag = new BagModel(opts.equipmentBag)
        this.equipmentBag2 = new BagModel(opts.equipmentBag2)
        this.treasureBag = new BagModel(opts.treasureBag)
        this.formation = new FormationModel(opts.formation)
        this.viewShow = opts.viewShow || {}
        this.equipmentMaxPower = opts.equipmentMaxPower || {}
        this.equipmentMaxPowerData = opts.equipmentMaxPowerData || {}
        this.teamList = new TeamModel(opts.teamList)
        this.resource = new ResourceModel(opts.resource)
        this.task = new TaskModel(opts.task)
        this.diary = new DiaryModel(opts.diary)
        this.market = new MarketModel(opts.market)
        this.info = opts.info || { menu: { bar: true } }
        this.isNewPlayer = opts.isNewPlayer || false
        this.getResourceDate = opts.getResourceDate || new Date().getTime()
        this.barTeamList = opts.barTeamList || [null, null, null, null, null]
        this.worldBossInfo = opts.worldBossInfo || {}
        this.deepInfo = opts.deepInfo || new DeepModel({})
        this.treasureInfo = opts.treasureInfo || new TreasureInfoModel({})
        this.totalPower = opts.totalPower || 0
        this.consumptiomInfo = opts.consumptiomInfo || new ConsumptiomInfo({})
        this.wbInfo = opts.wbInfo || new WorldBossModel({})
        this.gameSet = opts.gameSet || { autoEquipGem: false, autoEquipHole: false, gameMode: 0 }
        this.arenaInfo = opts.arenaInfo || new ArenaInfoModel({})
        this.alchemyInfo = opts.alchemyInfo || new AlchemyInfoModel({})
        this.floorStop = opts.floorStop || {}
        this.townInfo = opts.townInfo || new TownInfoModel({})
        this.titleInfo = opts.titleInfo || new TitleInfo({})
    }
}

